home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 52
/
Amiga Format AFCD52 (Issue 136, May 2000).iso
/
-screenplay-
/
hd_installers
/
whdigames
/
whdigamesc-d
/
cannonfodder2.lha
/
CannonFodder2 Install
/
Cannon2
next >
Wrap
Text File
|
1997-02-04
|
5KB
|
259 lines
;----------------------------
; BJ (02.02.97)
; tabsize=4
;----------------------------
;****************************
(set #readme-file "README") ;name of readme file
(set #slave-name "cf2.slave") ;optional !
(set #cleanup "") ;files to delete after install
(set #CI_drive "DF0:") ;default source drive
;****************************
(if
#slave-name
("")
(set #slave-name ("%s.slave" @app-name))
)
;****************************
;----------------------------
; Checks if given program is reachable via the path
; parameters:
; #program - to check
; result:
; #instok - 0 if not found
(procedure P_chkinst
(if
(= 0 (run ("cd SYS:\nWhich %s" #program)))
(set #instok 1)
(set #instok 0)
)
)
;----------------------------
; Checks if given program is reachable via the path
; if not reachable tries to install from local to RAM:
; if fails abort install
; parameters:
; #program - to check
(procedure P_chkrun
(P_chkinst)
(if
(= #instok 0)
(
(if
(exists #program)
(copyfiles
(help @copyfiles-help)
(source #program)
(dest "RAM:") ;should always be in the path
)
(if
(exists ("//c/%s" #program)) ;on installation package
(copyfiles
(help @copyfiles-help)
(source ("//c/%s" #program))
(dest "RAM:") ;should always be in the path
)
(abort ("You must install %s first !" #program))
)
)
(set #cleanup ("RAM:%s %s" #program #cleanup))
)
)
)
;----------------------------
(procedure P_install
(
(set #sver (getversion #source-file))
(if
(exists #dest-file)
(
(set #dver (getversion #dest-file))
(if (>= #sver #dver)
(
(if
(= @user-level 2)
(message ("\nnow installing\n\n\"%s\" %ld.%ld\n\nover\n\n\"%s\" %ld.%ld" #source-file (/ #sver 65536) (BITAND #sver 65535) #dest-file (/ #dver 65536) (BITAND #dver 65535)))
)
(copyfiles
(help @copyfiles-help)
(source #source-file)
(dest (pathonly #dest-file))
(newname (fileonly #dest-file))
)
)
)
)
(
(if
(= @user-level 2)
(message ("\nnow installing\n\n\"%s\" %ld.%ld\n\nto\n\n\"%s\"" #source-file (/ #sver 65536) (BITAND #sver 65535) #dest-file ))
)
(copyfiles
(help @copyfiles-help)
(source #source-file)
(dest (pathonly #dest-file))
(newname (fileonly #dest-file))
)
)
)
)
)
;****************************
(if
(exists #readme-file)
(if
(= 0 (run ("SYS:Utilities/Multiview %s" #readme-file)))
("")
(run ("SYS:Utilities/More %s" #readme-file))
)
)
;install whdload if available
(set #file "WHDLoad")
(if
(exists #file)
(
(set #source-file #file)
(set #dest-file (tackon "C:" #file))
(P_install)
)
)
;check if WHDLoad is installed
(set #program "WHDLoad")
(P_chkinst)
(if
(= #instok 0)
(abort "You must install WHDLoad first !")
)
(set @default-dest
(askdir
(prompt ("Where should \"%s\" installed ?\nA drawer \"%s\" will automatically created." @app-name @app-name))
(help @askdir-help)
(default @default-dest)
(disk)
)
)
(set #dest (tackon @default-dest @app-name))
;if anything similar exist delete it
(if
(exists #dest)
(run ("Delete %s %s.info all" #dest #dest))
)
(makedir #dest
(help @makedir-help)
(infos)
)
;----------------------------
(copyfiles
(help @copyfiles-help)
(source #slave-name)
(dest #dest)
)
(copyfiles
(help @copyfiles-help)
(source ("%s.inf" @app-name ))
(newname ("%s.info" @app-name ))
(dest #dest)
)
(if
(exists #readme-file)
(copyfiles
(help @copyfiles-help)
(source #readme-file)
(dest #dest)
)
)
(makedir
(tackon #dest "save")
(help @makedir-help)
)
(makedir
(tackon #dest "data")
(help @makedir-help)
)
(set #dest (tackon #dest "data"))
; in expert mode ask for source drive
(if
(= @user-level 2)
(set #CI_drive
(askstring
(prompt "Select source drive for diskimages")
(default #CI_drive)
(help @askstring-help)
)
)
)
;----------------------------
; Wait for right disk, and copy all to #dest
; parameters:
; #DR_diskno - DiskNumber
; #CI_drive - DriveToReadFrom
(procedure P_diskreq
(message ("\nInsert \"%s\"\n\nDisk %ld\n\ninto drive %s !" @app-name #DR_diskno #CI_drive))
(if
(exists ("%sdisk%ld" #CI_drive #DR_diskno))
("")
(P_diskreq)
)
)
(set #DR_diskno 1)
(P_diskreq)
(copyfiles
(help @copyfiles-help)
(source ("%s" #CI_drive))
(dest #dest)
(pattern "~(disk1|mapm#?|s|cf2.rel|ssboot)")
)
(set #DR_diskno 2)
(P_diskreq)
(copyfiles
(help @copyfiles-help)
(source ("%s" #CI_drive))
(dest #dest)
(pattern "~(disk2)")
)
(set #DR_diskno 3)
(P_diskreq)
(copyfiles
(help @copyfiles-help)
(source ("%s" #CI_drive))
(dest #dest)
(pattern "~(disk3|hi#?|ic#?|mapm1.spt|morp#?|ps#?|ra#?)")
)
;----------------------------
(run ("cd %s\nDelete %s ALL QUIET FORCE" #dest #cleanup)) ;delete all temporary files
(exit)